Control Widget PRO
The ControlWidget API enables users to add custom Button or Toggle controls to the iOS Control Center or Lock Screen. Each control is linked to an AppIntent to execute custom script logic. The controls support privacy protection, dynamic state labels, and SFSymbols icons.
Control Label Type
ControlWidgetLabel
Represents a label for a control, including the main label or value label in active/inactive state.
1. ControlWidgetButton
Renders a button control that executes a script intent when tapped.
ControlWidgetButtonProps
If either
activeValueLabelorinactiveValueLabelis provided, both should be specified to ensure proper state display.
2. ControlWidgetToggle
Renders a toggle control that updates a boolean value using a script intent.
ControlWidgetToggleProps<T>
3. ControlWidget Namespace
ControlWidget.parameter: string
A user-defined string parameter set during control configuration. Useful for targeting specific resources (e.g., a device ID or door ID).
ControlWidget.present(element: VirtualNode): void
Displays the control UI. Only ControlWidgetButton or ControlWidgetToggle elements are supported.
Usage Notes:
control_widget_button.tsxmust only render aControlWidgetButton.control_widget_toggle.tsxmust only render aControlWidgetToggle.- To hide the entire control content on the Lock Screen, use
privacySensitiveon the root. - To redact only specific labels or values, apply
privacySensitiveinsideControlWidgetLabel.
Example:
ControlWidget.reloadButtons(): void
Reloads all control widget buttons. Useful when the intent result changes the UI state.
ControlWidget.reloadToggles(): void
Reloads all toggle widgets. Call this after a toggle action to update state.
4. Development Notes
- Every control must be associated with an
AppIntentto define its behavior. - Toggle controls must pass an intent with a parameter shape
{ value: boolean }. - If using value labels (
activeValueLabel/inactiveValueLabel), always provide both. - System images (
systemImage) should follow SF Symbols naming conventions. - Use
ControlWidget.reloadButtons()andreloadToggles()to force UI updates after state changes in the background.
